if (previous_save[0] != '\0' && fexist(fconv(previous_save))) {
rename(fconv(previous_save), fconv(save));
if (fexist(fconv(save))) {
found = 1;
if ((opt->debug>1) && (opt->log!=NULL)) {
fspc(opt->log,"debug"); fprintf(opt->log,"File '%s' has been renamed since last mirror to '%s' ; applying changes"LF, previous_save, save); test_flush;
}
} else {
if ((opt->debug>0) && (opt->log!=NULL)) {
fspc(opt->log,"error"); fprintf(opt->log,"Could not rename '%s' to '%s' ; will have to retransfer it"LF, previous_save, save); test_flush;
}
}
}
}
if (!found) {
#if HTS_FAST_CACHE
hash_pos_return=0;
#else
a=NULL;
#endif
// dΘvalider car non prΘsent sur disque dans structure originale!!!
// sinon, le fichier est ok α priori, mais on renverra un if-modified-since pour
// en Ωtre s√r
if (opt->norecatch) { // tester norecatch
if (!fexist(fconv(save))) { // fichier existe pas mais dΘclarΘ: on l'a effacΘ
FILE* fp=fopen(fconv(save),"wb");
if (fp) fclose(fp);
if (opt->log!=NULL) {
fspc(opt->log,"warning"); fprintf(opt->log,"File must have been erased by user, ignoring: %s%s"LF,back[p].url_adr,back[p].url_fil); test_flush;
}
}
}
}
}
}
}
}
//
} else
#if HTS_FAST_CACHE
hash_pos_return=0;
#else
a=NULL;
#endif
// Existe pas en cache, ou bien pas de cache prΘsent
#if HTS_FAST_CACHE
if (hash_pos_return) { // OK existe en cache (et donnΘes aussi)!
#else
if (a!=NULL) { // OK existe en cache (et donnΘes aussi)!
#endif
if (cache->type==1) { // cache prioritaire (pas de test if-modified..)
// dans ce cas on peut Θgalement lire des rΘponses cachΘes comme 404,302...
fspc(opt->errlog,"warning"); fprintf(opt->errlog,"File seems complete (same size), but there was a cache read error: %s%s"LF,back[i].url_adr,back[i].url_fil); test_flush;
}
}
if (r.adr) {
freet(r.adr);
}
}
}
}
// Various hacks to limit re-transfers when updating a mirror
// Detect already downloaded file (with another browser, for example)
if (opt->sizehack) {
if (!back[i].is_update) { // mise α jour
if (back[i].r.statuscode==200 && !back[i].testmode) { // 'OK'
if (!is_hypertext_mime(back[i].r.contenttype, back[i].url_fil)) { // not HTML
if (strnotempty(back[i].url_sav)) { // target found